1. Field of the Invention
The present invention relates to a print control unit and a print control method, and a storage medium storing a print control program. More specifically, the invention is related to a control of transferring a carriage to a target position and stop it there against unexpected load. This control is called load-applied positioning control hereinafter.
2. Description of Related Art
In a typical serial printer such as an ink jet printer, a recording head scans on a printing paper to print. This recording head is fixed to a carriage to move with the carriage. This carriage is driven by a DC(Direct Current) motor.
A control of the carriage from a stop position to a target position is a PID control based on a speed deviation of a detected speed from a target speed calculated based on a positional deviation of a detected position of the carriage from the target position.
Unexpected load is sometimes applied to a carriage of a printing apparatus during carriage transfer, ink replenishment at a target position, and so on. This causes stoppage of the carriage during the transfer or stoppage at a position apart from the target position. A DC motor is driven by PID control, for example, to transfer the carriage to the target position.
A conventional PID control of transferring a carriage from a stop position to a target position is, however, not designed to accept a heavy load to be applied to a the carriage (an object to be controlled), thus being not able to transfer the carriage to the target position.
Continuous carriage stoppage is a harder task for PID control even if it is possible to transfer the carriage to the target position.
It is therefore an object of the present invention to eliminate the aforementioned problems and to provide a control unit and a print control method and also a storage medium storing print control program, capable of transferring and stopping an object to be controlled at a target position even when unexpected load is applied to the object.
In order to accomplish the aforementioned and other objects, according to one aspect of the present invention, there is provided a print control unit including: a position detecting part to detect a position and a transfer direction of an object to be controlled and driven by a motor; a speed detecting part to detect at least a physical value that corresponds to a speed of the object; a first control part to decide a current value to be supplied to the motor so that the speed of the object reaches a target speed, based on the output of the position detecting part and at least one of control parameters, thus controlling the motor based on the current value decided by the first control part; a second control part to decide a current value to be supplied to the motor so that the speed of the object reaches the target speed, based on the outputs of the position detecting part and the speed detecting part, and at least one of the control parameters, thus controlling the motor based on the current value decided by the second control part; a third control part to decide a current value to be supplied to the motor so that the object stops within a predetermined range, based on the output of the position detecting part and at least one of the control parameters, thus controlling the motor based on the decided current value; and a selection control part, operating at a predetermined timing, to select and set the control parameters in accordance with the target speed, to judge as to whether the object is located within a target range, based on the output of the position detecting part, if located, the selection control part selecting and operating the third control part, while if the object is not located within the target range, the selection control part selecting and operating the first or the second control part based on the physical value corresponding to the speed.
The print control unit as constructed above according to the present invention achieves object transfer and stoppage at a target position even when unexpected load is applied to an object to be controlled.
Moreover, the present invention provides a print control method used for a print control unit including a position counter having a counter that detects leading and trailing edges of output pulses of an encoder that is transferred with a carriage driven by a carriage motor, and counts up the detected edges while the carriage motor is rotating in a normal direction, on the other hand, counts down the detected edges while the carriage motor is rotating in a reverse direction, thus the position counter generating pulses in synchronism with the leading and trailing edges; a period counter to detect the leading and trailing edges of the output pulses of the encoder, and measure a period between the edges; and a timer counter having a set value corresponding to the target speed of the carriage, a counted value of the timer counter being reset when the counted value has reached a set value or when the timer counter receives the pulses from the position counter, the method including the steps of: supplying an initial current value to the carriage motor; comparing the counted value of the position counter and the target position of the carriage when the timer counter receives the pulses from the position counter or when the counted value of the timer counter reaches the set value; performing hold control so that the carriage is stopped within an allowable range including a target range based on the output of the position counter and at least one of control parameters when the position of the carriage is located within the target range including the target position; performing timer interruption control so that a speed of the carriage reaches the target speed based on the output of the position counter and the control parameter when the position of the carriage is not located within the target range and when the timer counter receives no pulses from the position counter even the counted value of the timer counter has reached the set value; and performing encoder interruption control so that the speed of the carriage reaches the target speed based on the outputs of the position counter and the period counter and also the control parameter when the position of the carriage is not located within the target range and when the timer counter receives pulses from the position counter until the counted value of the timer counter reaches set value.
The print control method as described above according to the present invention achieves object transfer and stoppage at a target position even when unexpected load is applied to an object to be controlled.
Furthermore, the present invention provides a computer-readable storage medium storing control program code for controlling a print control unit, including: first program code means for supplying an initial current value to a carriage motor for driving a carriage; second program code means for comparing a counted value of a position counter and a target position of the carriage when a timer counter receives pulses from the position counter or when the counted value of the timer counter reaches the set value; third program code means for performing hold control so that the carriage is stopped within an allowable range including a target range based on the output of the position counter and at least one of control parameters when the position of the carriage is located within the target range including the target position; forth program code means for performing timer interruption control so that a speed of the carriage reaches the target speed based on the output of the position counter and the control parameter when the position of the carriage is not located within the target range and when the timer counter receives no pulses from the position counter even the counted value of the timer counter has reached the set value; and fifth program code means for performing encoder interruption control so that the speed of the carriage reaches the target speed based on the outputs of the position counter and the period counter and also the control parameter when the position of the carriage is not located within the target range and when the timer counter receives pulses from the position counter until the counted value of the timer counter reaches set value.